<?php
//User interface that allows a user to select an incomplete inspection or start a new inspection.
	include 'common.php';
	print_header();
	session_start();
	$user = $_SESSION['user'];
?>	
	<div id="userDiv">
			<p id="userName">UserName: <?= $user ?></p>
			<form action="index.php">
				<button type="submit" class="unButtons">Log Out</button>
			</form>
			<form action="controlpanel.php">
				<button type="submit" class="unButtons">Back</button>
			</form>
		</div>
		<?php
			$inspectionList = file("../files/incompleteInspectionsList.txt");
			$facilityList = file("../files/facilityList.txt");
			$protocolList = file("../files/templateList.txt");
		?>
		<div id="incomplete">
			<p>Previous incomplete lab inspections:</p>
			<form action="viewCheckList.php">
				<select name="file">
					<?php
						foreach($inspectionList as $file){
					?>
						<option value="<?=$file?>"> <?=$file ?> </option>
					<?php 
						}
					?>
				</select>
				<button type="submit">Continue</button>
			</form>
		</div>
		<div id="newInspection">
			<p id="inspectionTitle">New Lab Inspection</p>
			<br />
			<form action="viewCheckList.php" enctype="multipart/form-data" method="post">
				<input type="hidden" name="date" value="<?php echo date("m-d-y");?>_"/>
				<!-- Date is returned in the format designated by the server. -->
				<input type="hidden" name="time" value="<?php echo date("g:iA");?>_"/>
				<p>Facility:</p>
				<select name="facility">
					<?php foreach($facilityList as $facility){ ?>
							<option value="<?php echo trim($facility);?>_"><?php echo $facility;?></option>
						<?php } ?>
				</select>
				<br />
				<p>Checklist Protocol:</p>
				<select name="protocol">
				<?php
					foreach($protocolList as $protocol){
				?>
						 <option value="<?=$protocol?>"> <?=$protocol ?> </option>
				<?php 
					}
				?>
				</select>
				<br />
				<input type="submit" value="Create"/>
			</form>
		</div>

<?php
	print_footer();
?>